home *** CD-ROM | disk | FTP | other *** search
- import java.io.IOException;
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Font;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
-
- class mmCanvas extends Canvas implements Runnable {
- // $FF: renamed from: i int
- int field_0;
- // $FF: renamed from: j int
- int field_1;
- // $FF: renamed from: k int
- int field_2;
- // $FF: renamed from: l int
- int field_3;
- int seed = 1;
- int state = 0;
- long nextTime;
- long now;
- Image maze;
- Image buf;
- Image mazebuf;
- Image[] imgs = new Image[27];
- // $FF: renamed from: bg javax.microedition.lcdui.Graphics
- Graphics field_4;
- // $FF: renamed from: mg javax.microedition.lcdui.Graphics
- Graphics field_5;
- Command startCommand;
- Command pauseCommand;
- // $FF: renamed from: pX int
- int field_6;
- // $FF: renamed from: pY int
- int field_7;
- int pDir;
- int pLook;
- int pCount;
- int pState;
- // $FF: renamed from: mX int
- int field_8;
- // $FF: renamed from: mY int
- int field_9;
- int wantDir;
- int dots;
- int lives;
- int level;
- int eatCount;
- // $FF: renamed from: gX int[]
- int[] field_10 = new int[3];
- // $FF: renamed from: gY int[]
- int[] field_11 = new int[3];
- int[] gDir = new int[3];
- int[] gState = new int[3];
- int[] gCount = new int[3];
- int[] gLook = new int[3];
- int[] sLook = new int[4];
- // $FF: renamed from: sX int[]
- int[] field_12 = new int[4];
- // $FF: renamed from: sY int[]
- int[] field_13 = new int[4];
- int[] sCount = new int[4];
- // $FF: renamed from: w int
- int field_14;
- // $FF: renamed from: h int
- int field_15;
- int counter = 0;
- int oldState;
- int speed;
- int targetX;
- int targetY;
- int bestVal;
- int bestDir;
- int randomness;
- // $FF: renamed from: f javax.microedition.lcdui.Font
- Font field_16 = Font.getFont(0, 0, 0);
- char[] scoreChars = new char[6];
- char[] levelChars = new char[2];
- // $FF: renamed from: fH int
- int field_17;
- // $FF: renamed from: fW int
- int field_18;
- // $FF: renamed from: lW int
- int field_19;
- String[] various = new String[]{"Karl H├╢rnell presents", "The Bad Guys:", "Bill", "Paul", "Steve"};
- String dummyScore = "00000";
- String dummyLevel = "00";
- // $FF: renamed from: dx int[]
- final int[] field_20 = new int[]{0, 0, 0, -1, 1};
- // $FF: renamed from: dy int[]
- final int[] field_21 = new int[]{0, -1, 1, 0, 0};
- final int[] offsX = new int[]{-6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -7, -7, -7, -7};
- final int[] offsY = new int[]{-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 0, -2, -2, -2, 0, 0, 0, 0};
- final int[] bonuses = new int[]{8, 1, 2, 4};
- final int[] dPos = new int[]{0, -31, 31, -1, 1};
- int[] map = new int[]{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 2, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 2, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 1, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 1, 8, 8, 1, 8, 8, 8, 8, 8, 8, 8, 8, 1, 8,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, 8, 8, 8, 8, 8, 1, 8, 8, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
- Thread runner;
- // $FF: renamed from: x0 int
- int field_22;
- // $FF: renamed from: y0 int
- int field_23;
-
- public mmCanvas(Command var1, Command var2) {
- this.startCommand = var1;
- this.pauseCommand = var2;
-
- try {
- this.maze = Image.createImage("/pics/pacmaze.png");
-
- for(this.field_0 = 0; this.field_0 < 27; ++this.field_0) {
- this.imgs[this.field_0] = Image.createImage("/pics/img" + this.field_0 + ".png");
- }
- } catch (IOException var4) {
- }
-
- this.field_14 = ((Canvas)this).getWidth();
- this.field_15 = ((Canvas)this).getHeight();
- if (this.field_14 > 112) {
- this.field_22 = (this.field_14 - 112) / 2;
- this.field_14 = 112;
- }
-
- if (this.field_15 > 133) {
- this.field_23 = (this.field_15 - 133) / 2;
- this.field_15 = 133;
- }
-
- this.buf = Image.createImage(this.field_14, this.field_15);
- this.mazebuf = Image.createImage(112, 124);
- this.field_4 = this.buf.getGraphics();
- this.field_5 = this.mazebuf.getGraphics();
- this.field_4.setColor(0, 0, 0);
- this.field_4.fillRect(0, 0, this.field_14, this.field_15);
- this.field_16 = Font.getFont(0, 0, 0);
- this.field_17 = this.field_16.getHeight() - 1;
- if (this.field_17 > 10) {
- this.field_16 = Font.getFont(0, 0, 8);
- this.field_17 = this.field_16.getHeight() - 1;
- if (this.field_17 > 11) {
- this.field_17 = 11;
- }
- }
-
- this.field_4.setFont(this.field_16);
- this.field_5.setFont(this.field_16);
- this.field_18 = this.field_16.stringWidth(this.dummyScore);
- this.field_19 = this.field_16.stringWidth(this.dummyLevel);
- this.prepareIntro();
- this.runner = new Thread(this);
- this.runner.start();
- }
-
- public void prepareIntro() {
- this.field_5.setColor(0, 0, 0);
- this.field_5.fillRect(0, 0, this.field_14, this.field_15 - 9);
- this.field_5.drawImage(this.imgs[25], (this.field_14 - 96) / 2, 11, 16 | 4);
- this.field_5.setColor(255, 255, 255);
- this.field_5.drawString(this.various[0], (this.field_14 - this.field_16.stringWidth(this.various[0])) / 2, 0, 16 | 4);
- this.field_5.drawString(this.various[1], (this.field_14 - this.field_16.stringWidth(this.various[1])) / 2, 35, 16 | 4);
- this.field_4.setClip(0, 0, this.field_14, this.field_15 - 9);
- this.state = 10;
- this.oldState = 10;
- this.counter = 0;
- ((Displayable)this).removeCommand(this.pauseCommand);
- ((Displayable)this).addCommand(this.startCommand);
- }
-
- public void resetGame() {
- this.field_4.setClip(0, 0, this.field_14, this.field_15);
- this.field_4.setColor(0, 0, 0);
- ((Displayable)this).removeCommand(this.startCommand);
- ((Displayable)this).addCommand(this.pauseCommand);
-
- for(this.field_0 = 0; this.field_0 < 6; ++this.field_0) {
- this.scoreChars[this.field_0] = '0';
- }
-
- this.lives = 2;
- this.level = 1;
- this.field_4.fillRect(0, this.field_15 - 9, this.field_14, 9);
- this.field_4.drawImage(this.imgs[5], this.field_18 + 8, this.field_15 - 8, 16 | 4);
- this.field_4.drawImage(this.imgs[5], this.field_18 + 18, this.field_15 - 8, 16 | 4);
- this.resetMap();
- }
-
- public void resetMap() {
- for(this.field_0 = 0; this.field_0 < 930; ++this.field_0) {
- int[] var10000 = this.map;
- int var10001 = this.field_0;
- var10000[var10001] &= 11;
- }
-
- this.dots = 0;
- this.field_5.drawImage(this.maze, 0, 0, 16 | 4);
- this.field_4.setColor(0, 0, 0);
- this.field_4.fillRect(this.field_14 - this.field_19 - 10, this.field_15 - 9, this.field_19 + 10, 9);
- this.field_4.setColor(255, 255, 255);
- this.levelChars[1] = (char)(48 + this.level % 10);
- this.levelChars[0] = (char)(48 + this.level / 10 % 10);
- this.field_4.drawChars(this.levelChars, 0, 2, this.field_14 - this.field_19, this.field_15 - this.field_17, 16 | 4);
- this.field_4.drawImage(this.imgs[21 + (this.level + 3 & 3)], this.field_14 - this.field_19 - 10, this.field_15 - 8, 16 | 4);
- this.resetMobiles();
- }
-
- public void resetMobiles() {
- this.state = 0;
- this.counter = 0;
- this.field_6 = 58;
- this.field_7 = 92;
- this.pLook = 4;
- this.wantDir = 0;
- this.pDir = 0;
- this.pState = 0;
- this.pCount = 20;
-
- for(this.field_0 = 0; this.field_0 < 4; ++this.field_0) {
- this.sCount[this.field_0] = 0;
- }
-
- for(this.field_0 = 0; this.field_0 < 3; ++this.field_0) {
- this.gLook[this.field_0] = 8 + this.field_0;
- this.field_11[this.field_0] = 56;
- this.field_10[this.field_0] = 50 + 8 * this.field_0;
- this.gDir[this.field_0] = 3 + (this.randi() & 1);
- this.gCount[this.field_0] = 30 + 30 * this.field_0;
- this.gState[this.field_0] = 0;
- }
-
- if (this.map[541] + this.map[542] > 0) {
- this.map[541] = 0;
- this.map[542] = 0;
- this.field_5.setColor(0, 0, 0);
- this.field_5.fillRect(50, 66, 12, 8);
- }
-
- }
-
- public int randi() {
- this.seed = this.seed * 171 % 30269;
- return this.seed;
- }
-
- public void run() {
- while(true) {
- this.now = System.currentTimeMillis();
- if (this.nextTime < this.now + 15L) {
- this.nextTime = this.now + 15L;
- }
-
- try {
- Thread.sleep(this.nextTime - this.now);
- } catch (Exception var6) {
- }
-
- this.nextTime = System.currentTimeMillis() + 50L;
- ++this.counter;
- switch (this.state) {
- case 0:
- if ((this.counter & 255) == 255) {
- this.map[541] = 4;
- this.map[542] = 4;
- this.field_5.drawImage(this.imgs[21 + (this.level + 3 & 3)], 53, 66, 16 | 4);
- }
-
- --this.pCount;
- switch (this.pState) {
- case 0:
- if (this.pCount < 0) {
- this.pState = 1;
- this.field_6 = 56;
- this.wantDir = 3;
- this.field_5.setColor(0, 0, 0);
- this.field_5.fillRect(39, 67, 34, 6);
- }
- break;
- case 1:
- if ((this.field_6 & 3) + (this.field_7 & 3) == 0) {
- int var7 = (this.field_6 >> 2) + 31 * (this.field_7 >> 2);
- if (this.map[var7 + this.dPos[this.wantDir]] < 8) {
- this.pDir = this.wantDir;
- } else if (this.map[var7 + this.dPos[this.pDir]] > 7) {
- this.pDir = 0;
- }
-
- this.field_5.setColor(0, 0, 0);
- if (this.map[var7] == 1) {
- ++this.dots;
- ++this.scoreChars[5];
- this.map[var7] = 5;
- this.field_5.fillRect(this.field_6 - 4, this.field_7, 4, 4);
- } else if (this.map[var7] == 2) {
- ++this.dots;
- ++this.scoreChars[4];
- this.map[var7] = 6;
- this.field_5.fillRect(this.field_6 - 4, this.field_7, 4, 4);
- this.pCount = 100;
- this.eatCount = 0;
-
- for(int var13 = 0; var13 < 3; ++var13) {
- if (this.gState[var13] == 2) {
- this.gState[var13] = 3;
- this.gLook[var13] = 11;
- }
- }
- } else if (this.map[var7] == 4) {
- char[] var18 = this.scoreChars;
- var18[3] = (char)(var18[3] + this.bonuses[this.level & 3]);
- this.map[var7] = 0;
- this.map[var7 - 1] = 0;
- this.map[var7 + 1] = 0;
- this.field_5.fillRect(this.field_6 - 12, this.field_7 - 2, 20, 8);
-
- int var12;
- for(var12 = 0; this.sCount[var12] > 0; ++var12) {
- }
-
- this.sLook[var12] = 17 + (this.level + 3 & 3);
- this.sCount[var12] = 20;
- this.field_12[var12] = this.field_6;
- this.field_13[var12] = this.field_7;
- }
-
- int var21 = var7 + this.dPos[this.pDir];
- }
-
- this.field_6 += 2 * this.field_20[this.pDir];
- this.field_7 += 2 * this.field_21[this.pDir];
- if (this.field_6 < 0) {
- this.field_6 += 120;
- } else if (this.field_6 > 119) {
- this.field_6 -= 120;
- }
-
- if (this.pDir > 0) {
- this.pLook = this.pDir * 2 - 2 + (this.counter & 1);
- }
-
- if (this.dots == 244) {
- this.state = 2;
- this.pCount = 45;
- }
- }
-
- for(int var8 = 0; var8 < 3; ++var8) {
- switch (this.gState[var8]) {
- case 0:
- int[] var31 = this.field_10;
- var31[var8] += 4 * this.gDir[var8] - 14;
- if (this.field_10[var8] < 50 || this.field_10[var8] > 66) {
- var31 = this.field_10;
- var31[var8] -= 8 * this.gDir[var8] - 28;
- this.gDir[var8] = 7 - this.gDir[var8];
- }
-
- int var10002 = this.gCount[var8]--;
- if (this.gCount[var8] < 0 && this.field_10[var8] == 58) {
- this.gState[var8] = 1;
- this.gDir[var8] = 1;
- }
- break;
- case 1:
- int[] var29 = this.field_11;
- var29[var8] += 4 * this.gDir[var8] - 6;
- if (this.field_11[var8] == 44) {
- this.gState[var8] = 2;
- this.gDir[var8] = 3 + (this.pDir & 1);
- var29 = this.field_10;
- var29[var8] += 4 * this.gDir[var8] - 14;
- } else if (this.field_11[var8] == 56) {
- this.gCount[var8] = 30;
- this.gLook[var8] = 8 + var8;
- this.gDir[var8] = 3 + (this.counter & 1);
- this.gState[var8] = 0;
- }
- break;
- case 2:
- case 3:
- case 4:
- if (this.gState[var8] == 2) {
- this.speed = 2;
- this.targetX = this.field_6;
- this.targetY = this.field_7;
- this.randomness = 15;
- } else if (this.gState[var8] == 3) {
- this.speed = 1;
- this.targetX = 2 * this.field_10[var8] - this.field_6;
- this.targetY = 2 * this.field_11[var8] - this.field_7;
- this.randomness = 0;
- if (this.pCount < 20) {
- this.gLook[var8] = 11 + (this.counter & 1);
- } else {
- this.gLook[var8] = 11;
- }
- } else {
- this.speed = 4;
- this.targetX = 58;
- this.targetY = 44;
- }
-
- if ((this.field_10[var8] & 3) + (this.field_11[var8] & 3) == 0) {
- this.bestVal = 0;
- this.bestDir = 0;
- int var14 = (this.field_10[var8] >> 2) + 31 * (this.field_11[var8] >> 2);
- if (this.map[var14 - 31] < 8 && this.gDir[var8] != 2) {
- this.bestVal = 50;
- this.bestDir = 1;
- if (this.targetY < this.field_11[var8]) {
- this.bestVal += (this.randi() & this.randomness) + 1;
- }
- }
-
- if (this.map[var14 + 31] < 8 && this.gDir[var8] != 1) {
- int var3 = 50;
- if (this.targetY > this.field_11[var8]) {
- var3 += (this.randi() & this.randomness) + 1;
- }
-
- if (var3 > this.bestVal) {
- this.bestDir = 2;
- this.bestVal = var3;
- }
- }
-
- if (this.map[var14 - 1] < 8 && this.gDir[var8] != 4) {
- int var16 = 50;
- if (this.targetX < this.field_10[var8]) {
- var16 += (this.randi() & this.randomness) + 1;
- }
-
- if (var16 > this.bestVal) {
- this.bestDir = 3;
- this.bestVal = var16;
- }
- }
-
- if (this.map[var14 + 1] < 8 && this.gDir[var8] != 3) {
- int var17 = 50;
- if (this.targetX > this.field_10[var8]) {
- var17 += (this.randi() & this.randomness) + 1;
- }
-
- if (var17 > this.bestVal) {
- this.bestDir = 4;
- }
- }
-
- this.gDir[var8] = this.bestDir;
- if (this.gState[var8] == 3 && this.pCount < 0) {
- this.gState[var8] = 2;
- this.gLook[var8] = 8 + var8;
- this.speed = 2;
- } else if (this.gState[var8] == 4 && this.field_11[var8] == 44 && (this.field_10[var8] == 56 || this.field_10[var8] == 60)) {
- this.field_10[var8] = 58;
- this.gState[var8] = 1;
- this.gDir[var8] = 2;
- }
- }
-
- int[] var22 = this.field_10;
- var22[var8] += this.speed * this.field_20[this.gDir[var8]];
- var22 = this.field_11;
- var22[var8] += this.speed * this.field_21[this.gDir[var8]];
- if (this.field_10[var8] < 0) {
- var22 = this.field_10;
- var22[var8] += 120;
- } else if (this.field_10[var8] > 119) {
- var22 = this.field_10;
- var22[var8] -= 120;
- }
-
- if (this.field_10[var8] < this.field_6 + 8 && this.field_10[var8] > this.field_6 - 8 && this.field_11[var8] < this.field_7 + 8 && this.field_11[var8] > this.field_7 - 8) {
- if (this.gState[var8] != 3) {
- if (this.gState[var8] == 2) {
- this.state = 3;
- this.counter = -1;
- }
- } else {
- this.gLook[var8] = 13;
- this.gState[var8] = 4;
- var22 = this.field_10;
- var22[var8] &= 252;
- var22 = this.field_11;
- var22[var8] &= 252;
- ++this.eatCount;
- char[] var28 = this.scoreChars;
- var28[3] = (char)(var28[3] + this.bonuses[this.eatCount]);
-
- int var15;
- for(var15 = 0; this.sCount[var15] > 0; ++var15) {
- }
-
- this.sLook[var15] = 17 + this.eatCount;
- this.sCount[var15] = 20;
- this.field_12[var15] = this.field_6;
- this.field_13[var15] = this.field_7;
- }
- }
- }
- }
-
- this.field_4.setClip(0, 0, this.field_14, this.field_15 - 9);
- if (this.field_14 < 112) {
- this.field_8 = 50 - this.field_6;
- if (this.field_8 > 0) {
- this.field_8 = 0;
- } else if (this.field_8 < this.field_14 - 112) {
- this.field_8 = this.field_14 - 112;
- }
- }
-
- if (this.field_15 < 133) {
- this.field_9 = 51 - this.field_7;
- if (this.field_9 > 0) {
- this.field_9 = 0;
- } else if (this.field_9 < this.field_15 - 133) {
- this.field_9 = this.field_15 - 133;
- }
- }
-
- this.field_4.drawImage(this.mazebuf, this.field_8, this.field_9, 16 | 4);
-
- for(int var9 = 0; var9 < 4; ++var9) {
- if (this.sCount[var9] > 0) {
- int var35 = this.sCount[var9]--;
- this.field_4.drawImage(this.imgs[this.sLook[var9]], this.field_12[var9] + this.field_8 + this.offsX[this.sLook[var9]], this.field_13[var9] + this.field_9 + this.offsY[this.sLook[var9]], 16 | 4);
- }
- }
-
- this.field_4.drawImage(this.imgs[this.pLook], this.field_6 + this.field_8 + this.offsX[this.pLook], this.field_7 + this.field_9 + this.offsY[this.pLook], 16 | 4);
-
- for(int var10 = 0; var10 < 3; ++var10) {
- this.field_4.drawImage(this.imgs[this.gLook[var10]], this.field_10[var10] + this.field_8 + this.offsX[this.gLook[var10]], this.field_11[var10] + this.field_9 + this.offsY[this.gLook[var10]], 16 | 4);
- }
-
- this.field_4.setClip(0, 0, this.field_14, this.field_15);
-
- for(int var11 = 5; var11 > 0; --var11) {
- if (this.scoreChars[var11] > '9') {
- char[] var33 = this.scoreChars;
- var33[var11] = (char)(var33[var11] - 10);
- ++this.scoreChars[var11 - 1];
- }
- }
-
- if ((this.counter & 1) == 0) {
- this.field_4.setColor(0, 0, 0);
- this.field_4.fillRect(1, this.field_15 - 9, this.field_18, 9);
- this.field_4.setColor(255, 255, 255);
- this.field_4.drawChars(this.scoreChars, 1, 5, 1, this.field_15 - this.field_17, 16 | 4);
- }
- case 1:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- default:
- break;
- case 2:
- this.pLook = this.pLook & 254 | this.pCount-- & 1;
- this.field_4.drawImage(this.imgs[this.pLook], this.field_6 + this.field_8 + this.offsX[this.pLook], this.field_7 + this.field_9 + this.offsY[this.pLook], 16 | 4);
- if (this.pCount == 0) {
- ++this.level;
- ++this.scoreChars[2];
- this.resetMap();
- }
- break;
- case 3:
- this.field_4.setClip(0, 0, this.field_14, this.field_15 - 9);
- this.field_4.drawImage(this.mazebuf, this.field_8, this.field_9, 16 | 4);
- if (this.counter < 6) {
- this.pLook = 14 + this.counter / 2;
- this.field_4.drawImage(this.imgs[this.pLook], this.field_6 + this.field_8 + this.offsX[this.pLook], this.field_7 + this.field_9 + this.offsY[this.pLook], 16 | 4);
- }
-
- if (this.counter > 30) {
- --this.lives;
- if (this.lives < 0) {
- this.field_4.drawImage(this.imgs[26], (this.field_14 - 54) / 2, this.field_15 / 2 - 5, 16 | 4);
- this.state = 4;
- } else {
- this.field_4.setClip(0, 0, this.field_14, this.field_15);
- this.field_4.setColor(0, 0, 0);
- this.field_4.fillRect(this.field_18 + 8 + 10 * this.lives, this.field_15 - 8, 8, 8);
- this.resetMobiles();
- }
- }
- break;
- case 4:
- if (this.counter > 70) {
- this.prepareIntro();
- }
- break;
- case 10:
- this.field_4.drawImage(this.mazebuf, 0, 0, 16 | 4);
- int var1 = this.counter & 63;
- int var2 = this.counter / 64;
- if (var2 < 3) {
- this.field_4.drawImage(this.imgs[8 + var2], var1 + this.field_14 / 2 - 64, 49 + 11 * var2, 16 | 4);
- if (var1 == 63) {
- this.field_5.drawImage(this.imgs[8 + var2], var1 + this.field_14 / 2 - 64, 49 + 11 * var2, 16 | 4);
- this.field_5.drawString(this.various[2 + var2], this.field_14 / 2 + 10, 46 + 11 * var2, 16 | 4);
- }
- } else if (var1 == 63) {
- this.prepareIntro();
- }
-
- if ((this.counter & 32) == 0) {
- this.field_4.drawImage(this.imgs[6 + (this.counter & 1)], this.field_14 / 2 - 36 + 2 * (this.counter & 31), this.field_15 - 17, 16 | 4);
- } else {
- this.field_4.drawImage(this.imgs[4 + (this.counter & 1)], this.field_14 / 2 + 28 - 2 * (this.counter & 31), this.field_15 - 17, 16 | 4);
- }
- }
-
- ((Canvas)this).repaint(this.field_22, this.field_23, this.field_14, this.field_15);
- ((Canvas)this).serviceRepaints();
- }
- }
-
- public void resume() {
- this.state = this.oldState;
- if (this.oldState == 10) {
- this.resetGame();
- }
-
- ((Displayable)this).removeCommand(this.startCommand);
- ((Displayable)this).addCommand(this.pauseCommand);
- }
-
- public void pause() {
- this.oldState = this.state;
- this.state = 9;
- ((Displayable)this).removeCommand(this.pauseCommand);
- ((Displayable)this).addCommand(this.startCommand);
- }
-
- protected void keyPressed(int var1) {
- switch (((Canvas)this).getGameAction(var1)) {
- case 1:
- this.wantDir = 1;
- break;
- case 2:
- this.wantDir = 3;
- case 3:
- case 4:
- default:
- break;
- case 5:
- this.wantDir = 4;
- break;
- case 6:
- this.wantDir = 2;
- }
-
- }
-
- public void paint(Graphics var1) {
- if (var1.getClipX() < this.field_22 || var1.getClipWidth() > this.field_14 || var1.getClipY() < this.field_23 || var1.getClipHeight() > this.field_15) {
- var1.setColor(0);
- var1.fillRect(0, 0, ((Canvas)this).getWidth(), ((Canvas)this).getHeight());
- }
-
- var1.drawImage(this.buf, this.field_22, this.field_23, 16 | 4);
- }
- }
-